#pragma once
class CLock
{
public:
	CLock();
	~CLock();
	void Lock();
	void UnLock();
private:
	CRITICAL_SECTION m_cs;
};

class CLockOwner
{
public:
	CLockOwner(CLock &lock) :m_lock(lock)
	{
		m_lock.Lock();
	}
	~CLockOwner()
	{
		m_lock.UnLock();
	}
private:
	CLock &m_lock;

};